<?php
declare(strict_types=1);
namespace Field;

class AuthTaobaoCateConst
{
    public const pk='';
    public const index=['TbID','ParentTbID'];
	public const fields=['TbID','ParentTbID','Name','IsParent','Lv'];
	public const comment=['TbID'=>'','ParentTbID'=>'','Name'=>'','IsParent'=>'','Lv'=>''];
	/*
    * @Field TbID
    * @Type bigint(20)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const TbID = 'TbID';
    /*
    * @Field ParentTbID
    * @Type bigint(20)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const ParentTbID = 'ParentTbID';
    /*
    * @Field Name
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Name = 'Name';
    /*
    * @Field IsParent
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const IsParent = 'IsParent';
    /*
    * @Field Lv
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Lv = 'Lv';
}

class AuthTaobaoCateColumns
{
public  int $TbID;
   public  int $ParentTbID;
   public  ?string $Name='';
   public  int $IsParent=0;
   public  int $Lv=0;
	public function toArray():array
	{
		return [
'TbID'=>$this->TbID,
    'ParentTbID'=>$this->ParentTbID,
    'Name'=>$this->Name,
    'IsParent'=>$this->IsParent,
    'Lv'=>$this->Lv,        ];
	}
}

class AuthTaobaoCateRow
{
	public AuthTaobaoCateColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'TbID' => $this->data->TbID,
        'ParentTbID' => $this->data->ParentTbID,
        'Name' => $this->data->Name,
        'IsParent' => $this->data->IsParent,
        'Lv' => $this->data->Lv, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new AuthTaobaoCateColumns();
        isset($data['TbID']) && $this->data->TbID = (int)$data['TbID'];
           isset($data['ParentTbID']) && $this->data->ParentTbID = (int)$data['ParentTbID'];
           isset($data['Name']) && $this->data->Name = (string)$data['Name'];
           isset($data['IsParent']) && $this->data->IsParent = (int)$data['IsParent'];
           isset($data['Lv']) && $this->data->Lv = (int)$data['Lv'];
    }
}
?>